package fi.softala.multiplikation;

import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;

import android.os.Bundle;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.Toast;

public class KouluValintaActivity extends Activity {

	/*

	@Override
	protected void onCreate(Bundle savedInstanceState) {

		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_koulu_valinta);
		
		final SharedPreferences vastaanottajat = Storage.gamestorage;
		
		Button btTalletaKoulu = (Button) findViewById(R.id.btAsetaKoulu);
		btTalletaKoulu.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				SharedPreferences.Editor editor = vastaanottajat.edit();
				EditText etPelaajanNimi = (EditText)findViewById(R.id.etNimi);
				editor.putString("pelaajan_nimi", etPelaajanNimi.toString());
				editor.commit();
			}

				EditText etNimi = (EditText)findViewById(R.id.etNimi);
				String nimi = etNimi.toString();
				String[] nimiOsat = new String[2];
				nimiOsat = nimi.split(" ");
				nimi = nimiOsat[0] + "_" + nimiOsat[1];
				try {
					URL url = new URL("http://proto58.haaga-helia.fi/multiplicationsave/SaveController?nimi=" + nimi);
					try {
						URLConnection conn = url.openConnection();
					} catch (IOException e) {
						// TODO Auto-generated catch block
						e.printStackTrace();
					}
				} catch (MalformedURLException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
				showToast("Saved Your Info!");
			}

		});

	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.activity_koulu_valinta, menu);
		return true;
	}

	public void showToast(String toastText) {
		Context context = getApplicationContext();
		int duration = Toast.LENGTH_LONG;
		Toast toast = Toast.makeText(context, toastText, duration);
		toast.show();
	}
	*/
}
